int I1 = 4;
int I2 = 7;
int pwm = 5;
int rSW = 12;
int lSW = 13;
int valr = 0;
int vall = 0; 

void setup(){
  Serial.begin(9600);
  
  pinMode(rSW,INPUT);
  pinMode(lSW,INPUT);
  pinMode(I1, OUTPUT);
  pinMode(I2, OUTPUT);
}

void loop(){
  
  valr = digitalRead(rSW);
  vall = digitalRead(lSW);
 if(valr == HIGH){
   //counterclockwise
     Serial.println("COUNTERCLOCKWISE");
     analogWrite(pwm,7);
    digitalWrite(I1,LOW);
    digitalWrite(I2,HIGH);
  }
  else if(vall == HIGH){
    //clockwise
    Serial.println("CLOCKWISE");
    analogWrite(pwm,7);
    digitalWrite(I1,HIGH);
    digitalWrite(I2,LOW);
  }
  else{
    //Turn off
    analogWrite(pwm,0);
   Serial.println("Stop working");
  }

}
